<!DOCTYPE html>
<html>
    <head>
        <title>Test that watchAvailability() throws on low-end devices.</title>
        <script src="../../resources/testharness.js"></script>
        <script src="../../resources/testharnessreport.js"></script>
        <script src="util.js"></script>
    </head>
    <body>
        <script>
            // WPT: this test can't be moved to WPT because of its usage of:
            // - internals.setIsLowEndDevice()
            async_test(function(t)
            {
                enableRemotePlaybackBackendForTest(t);
                var v = document.createElement('video');
                v.src = '../content/test.ogv';
                document.body.appendChild(v);
                internals.setIsLowEndDevice(true);
                v.remote.watchAvailability(t.unreached_func()).then(
                    t.unreached_func(),
                    t.step_func_done(function(e) {
                        assert_equals(e.name, 'NotSupportedError');
                        assert_equals(e.message,
                           'Availability monitoring is not supported on this device.');
                        internals.setIsLowEndDevice(false);
                    }));
            }, 'Test that watchAvailability() throws on low-end devices.');
        </script>
    </body>
</html>
